package likou;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/08/22 14:08
 */
public class _413 {
    public int numberOfArithmeticSlices(int[] nums) {
        if (nums.length<3) return 0;
        int[] dp = new int[nums.length];
        int res = 0;
        for (int i=2;i<nums.length;i++){
            if (nums[i]-nums[i-1]==nums[i-1]-nums[i-2]){
                dp[i] = dp[i-1]+1;
                res += dp[i];
            }
        }
        return res;
    }
}
